<?php

require_once 'cf/init.inc';
require_once 'cf/ceo.inc';
require_once 'cf/db.inc';


$map = new SiteMap('http://lodki-palatki.ru/');
pages_to_sitemap($map);


$shopExport = 
	new ShopExportToSiteMapXML(
		$map,
		'group.php?groupId=',
		'product.php?productId=',
		'manufacturer.php?id='
	);
	
$shopExport->export();


$q = createQuery("SELECT id FROM articles");
$q->execute();
while ($q->fetch())
{
	$map->addUrl('article.php?articleId='.$q->at(0));
}



$q = createQuery("SELECT id FROM cf_gallery_albums");
$q->execute();
while ($q->fetch())
{
	$map->addUrl('album.php?albumId='.$q->at(0));
}


$q = createQuery("SELECT album_id, COUNT(id) FROM cf_gallery GROUP BY album_id");
$q->execute();
while ($q->fetch())
{
	$albumId = $q->at(0);
	$pictCount = $q->at(1);
	for ($page=1; $page<=$pictCount; ++$page)
	{
		$map->addUrl("image.php?albumId=$albumId&page=$page");
	}
}

?>